extends ../components/base
block title
    if(edit)
        title 用户编辑
    else
        title 用户查看
block style
    link(rel='stylesheet', href=__CSS_PATH__ + '/form.css')
    link(rel="stylesheet", href=__PLUGINS_PATH__ + "/ztree/zTreeStyle.css")
    style.
        .checkboxOther input{
            min-width:16px !important;
            margin-left: 15px;
        }
block aside_content
    include ../components/mixin
    -var routerObj = [{link:'/',text:'应用',icon:'icon-app'},{link:'/message',text:'消息',icon:'icon-message2'},{link:'/setting/user_manage',text:'平台管理',icon:'icon-setting'}]
    +asideNav(routerObj,1)
block main_content
    include ../components/mixin
    -var menuObj = [{link:'/setting/organization_manage',text:'平台自身管理'},{link:'/setting/contact_manage',text:'对接系统管理'},{link:'/setting/app_manage',text:'第三方应用系统管理'}]
    +menuLink(menuObj,0)
    -var navObj = [{link:'/setting/organization_manage',text:'组织机构管理'},{link:'/setting/user_manage',text:'用户管理'},{link:'/setting/role_manage',text:'角色权限管理'},{link:'/setting/region_manage',text:'行政区划分'},{link:'/setting/log_manage',text:'日志管理'}]
    +menuNav(navObj,1)
    if(edit)
        +RouteNav('用户编辑')
    else
        +RouteNav('用户查看')
    #inner-wrapper
        form.news-create(action="/setting/user_save" method="post")
            .work-form-control
                label.control-label(for='name') 用户名:
                input#name.form-control(type='text' name="name" value=userInfo.name)
            .work-form-control
                label.control-label(for='loginAccount') 登录账号:
                input#loginAccount.form-control(type='text' name="loginAccount" value=userInfo.loginAccount)
            .work-form-control.checkboxOther
                label.control-label 角色分配:
                if(rolesList.length)
                    each role in rolesList
                        if(userInfo.roleIds)
                            if(userInfo.roleIds.indexOf(role.id) !== -1)
                                input(type='checkbox' checked name="roleIds" value=role.id)
                            else
                                input(type='checkbox' name="roleIds" value=role.id)
                        else
                            input(type='checkbox' name="roleIds" value=role.id)
                        span #{role.name}
            .work-form-control
                label.control-label(for='deptIds') 部门分配:
                input#deptIds(type='hidden' name="deptIds" value=userInfo.deptIds)
                ul#tree.ztree(data-node=depAll)
                input#userId(type='hidden' name='userId' value=userId)
                input#edit(type='hidden' name='edit' value=edit)
            if(edit)
                .work-form-control.btn-wrapper
                    button.btn.btn-default.btn-sm(type='submit') 保存
                    button.btn.btn-disable.btn-sm(type='button' onclick="window.location.href='/setting/user_manage'" style='margin-left:20px') 取消
include ../components/checkTree
    +treeShowCheck()
